<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <style>
        html, body {
            background-color: #f8f8f8;
        }

        .main ul li:last-child .li_box {
        	border-bottom: none;
        }
        .li_box {
        	height: 50px;
        	line-height: 50px;
			display: -webkit-box;
			display: -webkit-flex;
			padding: 0 15px;
			background-color: #fff;
			border-bottom: 1px solid #e8e8e8;
        }
        .li_box .li_boxl {
        	color: #333;
            font-size: 15px;
        }
        .li_box .li_boxr {
        	width: 0;
            flex: 1;
            -webkit-flex: 1;
            box-flex: 1;
            -webkit-box-flex: 1;
            font-size: 12px;
            color: #999;
            display: -webkit-box;
            -webkit-box-align: center;
            -webkit-box-pack: end;
        }
        .li_box .li_boxr span {
        	display: block;
        }
        .li_box .li_boxr .right {
        	height: 13px;
        	display: block;
        	padding-left: 10px;
        }
        .li_box .li_boxr .img_icon {
        	height: 35px;
        	display: block;
        }
        .span_div {
        	width: 43px;
        	height: 24px;
        	line-height: 24px;
        	text-align: center;
        	color: #999;
        	font-size: 12px;
        	background-color: #f9f9f9;
        	border-radius: 5px;
        	border: 1px solid #dcdcdc;
        	box-sizing: border-box;
        	margin-left: 10px;
        }
        .span_div.active {
        	background-color: #ffa525;
        	color: #fff;
        }
        .span_div input {
        	display: none;
        }
        .span_s {
            width: 0;
            flex: 1;
            -webkit-flex: 1;
            box-flex: 1;
            -webkit-box-flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            text-align: right;
        }
    </style>
</head>
<body>
    <div class="main">
    	<ul id="data_ul">
    		<!-- <li>
    			<div class="li_box">
    				<div class="li_boxl">热销</div>
    				<div class="li_boxr">
    					<img class="right" src="../image/right.png">
    				</div>
    			</div>
    		</li> -->
    	</ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script id="dataTpl" type="text/x-dot-template">
    {{ for(var i=0;i<it.length;i++){ }}
        <li onclick="fnChoseCat({{=it[i]['id']}},'{{=it[i].category_name}}');" tapmode>
            <div class="li_box">
                <div class="li_boxl">{{=it[i]['category_name']}}</div>
                <div class="li_boxr">
                    <img class="right" src="../image/right.png">
                </div>
            </div>
        </li>

    {{ }; }}
</script>
<script type="text/javascript">
    apiready = function(){
        shop = $api.getStorage('shop_data');
        fnGetCats();
    };

    function fnGetCats() {
        api.ajax({
            url: rootPath+'/api/seller/shop_cats',
            method: 'get',
            data: {
                values: { 
                    shop_id: shop.id,
                    token : shop.token
                },
                
            }
        }, function(ret, err) {
            if (ret) {
                if(ret.status == 200) {
                    appendDotData(ret.data,'dataTpl','data_ul',true,false);
                }
            } else {
                alert(JSON.stringify(err.msg));
            }
        });
    }

    function fnChoseCat(cid,category_name) {
        api.sendEvent({
            name: 'addGoodsEvent',
            extra: {
                edit: 'shop_cid', 
                value: cid,
                desc: category_name
            }
        });
        api.closeWin();
    }
</script>
</html>